
import financeApi from '@/api/declaration/erp/financeApi'
import httpRequest from '@/config/axios/httpRequest'
import { FinancePaymentModel } from '@/models/erp/FinancePaymentModel'



// ERP 付款单 API
export const FinancePaymentApi = {
  // 查询付款单分页
  getFinancePaymentPage: async (params: any) => {
    return await httpRequest.get<FinancePaymentModel[]>(financeApi.GetFinancePaymentPage, { params })
  },

  // 查询付款单详情
  getFinancePayment: async (id: number) => {
    return await httpRequest.get(financeApi.GetFinancePayment, { params: { id } })
  },

  // 新增付款单
  createFinancePayment: async (data: FinancePaymentModel) => {
    return await httpRequest.post(financeApi.CreateFinancePayment, data)
  },

  // 修改付款单
  updateFinancePayment: async (data: FinancePaymentModel) => {
    return await httpRequest.put(financeApi.UpdateFinancePayment, data)
  },

  // 更新付款单的状态
  updateFinancePaymentStatus: async (id: number, status: number) => {
    return await httpRequest.put(financeApi.UpdateFinancePaymentStatus, { id, status })
  },

  // 删除付款单
  deleteFinancePayment: async (ids: number[]) => {
    return await httpRequest.delete(financeApi.DeleteFinancePayment, { params: { ids: ids.join(',') } })
  },

  // 导出付款单 Excel
  exportFinancePayment: async (params: any) => {
    return await httpRequest.download(financeApi.ExportFinancePayment, params)
  }
}
